home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2008 September
/
PCWorld_2008-09_cd.bin
/
temacd
/
xnview
/
XnView-beta1.exe
/
XnView
/
WebTemplate
/
Visuddhi - Lightbox [blue]
/
lightbox.js
< prev
next >
Wrap
Text File
|
2006-09-20
|
2KB
|
49 lines
/*
'
'**************************************
' Visuddhi - http://visuddhi.com
' Copyright (c) 2006 - Visuddhi
' All right reserved.
'**************************************
'
*/
function correctThumb(){
var max = maxer('thumb');
if (document.all){
document.styleSheets[0].addRule('table.dia', 'width:' + (max + 20) + 'px;');
document.styleSheets[0].addRule('table.dia', 'height:' + (max + 20) + 'px;');
document.styleSheets[0].addRule('div.smalldesc', 'width:' + (max + 20) + 'px;');
} else {
document.styleSheets[0].cssRules[6].style.width = (max + 20) + 'px';
document.styleSheets[0].cssRules[6].style.height = (max + 20) + 'px';
document.styleSheets[0].cssRules[7].style.width = (max + 20) + 'px';
}
}
function correctPic(){
var max = maxer('pic');
if (document.all){
document.styleSheets[0].addRule('table.image', 'width:' + (max + 40) + 'px;');
document.styleSheets[0].addRule('table.image', 'height:' + (max + 40) + 'px;');
} else {
document.styleSheets[0].cssRules[11].style.width = (max + 40) + 'px';
document.styleSheets[0].cssRules[11].style.height = (max + 40) + 'px';
}
}
function maxer(reltag){
var maxw = 0; var maxh = 0; var relAtt;
var thumbs = document.getElementsByTagName('img');
for (var i=0; i<thumbs.length; i++){
relAtt = thumbs[i].getAttribute('rel');
if (relAtt == reltag){
if (thumbs[i].width > maxw){ maxw = thumbs[i].width; }
if (thumbs[i].height > maxh){ maxh = thumbs[i].height; }
}
}
var max = maxh; if (maxw > maxh){ max = maxw; }
return max;
}